package avicit.bdp.dms.das.dto;

import avicit.bdp.common.base.BaseDTO;
import avicit.platform6.core.annotation.log.FieldRemark;
import avicit.platform6.core.annotation.log.Id;
import avicit.platform6.core.annotation.log.LogField;
import avicit.platform6.core.properties.PlatformConstant;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils;

import javax.persistence.Column;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.List;
import java.util.Objects;

/**
 * @金航数码科技有限责任公司
 * @作者：developer
 * @邮箱：developer@avic-digital.com
 * @创建时间： 2020-06-24 14:53
 * @类说明：bdp_das_category
 * @修改记录：
 */
@ApiModel(value = "BdpDasCategoryDTO", description = "数据模型分类实体类")
@Table(name = "bdp_das_category")
public class BdpDasCategoryDTO extends BaseDTO {
    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    @Id
    @LogField
    @ApiModelProperty(value = "id", name = "id")
    @FieldRemark(column = "id", field = "id", name = "主键")
    @javax.persistence.Id
    @Column(name = "id")
    private String id;

    /**
     * 业务域分类名称
     */
    @LogField
    @ApiModelProperty(value = "业务域分类名称", name = "name")
    @FieldRemark(column = "name", field = "name", name = "业务域分类名称")
    @Column(name = "name")
    private String name;

    /**
     * 业务域分类code
     */
    @LogField
    @ApiModelProperty(value = "业务域分类code", name = "code")
    @FieldRemark(column = "code", field = "code", name = "业务域分类code")
    @Column(name = "code")
    private String code;

    /**
     * 业务域分类父节点ID
     */
    //@LogField
    @ApiModelProperty(value = "业务域分类父节点ID", name = "parentId")
    //@FieldRemark(column = "parent_id", field = "parentId", name = "业务域分类父节点ID")
    @Column(name = "parent_id")
    private String parentId;

    /**
     * 是否子节点 1-是 0-否
     */
    @LogField
    @ApiModelProperty(value = "是否子节点 1-是 0-否", name = "type")
    @FieldRemark(column = "type", field = "type", name = "是否子节点")
    @Column(name = "type")
    private Integer type;

    /**
     * 状态 1-启用 0-停用
     */
    @LogField
    @ApiModelProperty(value = "状态 1-启用 0-停用", name = "status")
    @FieldRemark(column = "status", field = "status", name = "状态 1-启用 0-停用")
    @Column(name = "status")
    private Integer status;

    /**
     * 是否子节点 1-是 0-否
     */
    @LogField
    @ApiModelProperty(value = "是否子节点 1-是 0-否", name = "leaf")
    @FieldRemark(column = "leaf", field = "leaf", name = "是否子节点")
    @Column(name = "leaf")
    private Integer leaf;

    /**
     * 备注
     */
    @LogField
    @ApiModelProperty(value = "备注", name = "remark")
    @FieldRemark(column = "remark", field = "remark", name = "备注")
    @Column(name = "remark")
    private String remark;

    /**
     * 排序
     */
    @LogField
    @ApiModelProperty(value = "排序", name = "orderBy")
    @FieldRemark(column = "order_by", field = "orderBy", name = "排序")
    @Column(name = "order_by")
    private Integer orderBy;


    /**
     * 是否为表
     */
    @Transient
    private Integer tableFlag = 0;

    /**
     * 是否已落库(针对表)
     */
    @Transient
    private Integer storeStatus = 1;

    /**
     * 启用停用是否包含下级节点
     */
    @Transient
    private Integer lowerNode = 0;

    @Transient
    private String statusString;

    //父主题名称
    @Transient
    private String parentName;

    public Integer getTableFlag() {
        return tableFlag;
    }

    public void setTableFlag(Integer tableFlag) {
        this.tableFlag = tableFlag;
    }

    /**
     * 子对象集合
     */
    @Transient
    private List<BdpDasCategoryDTO> children;

    /**
     * 授权项，0：查看，1：编辑，2：数据查看
     */
    @Transient
    private Integer action;
    private List<Integer> actionList;


    public List<BdpDasCategoryDTO> getChildren() {
        return children;
    }

    public void setChildren(List<BdpDasCategoryDTO> children) {
        this.children = children;
    }


    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getParentId() {
        return parentId;
    }

    public void setParentId(String parentId) {
        this.parentId = parentId;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getLeaf() {
        return leaf;
    }

    public void setLeaf(Integer leaf) {
        this.leaf = leaf;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Integer getOrderBy() {
        return orderBy;
    }

    public void setOrderBy(Integer orderBy) {
        this.orderBy = orderBy;
    }

    public Integer getAction() {
        return action;
    }

    public void setAction(Integer action) {
        this.action = action;
    }

    public List<Integer> getActionList() {
        return actionList;
    }

    public void setActionList(List<Integer> actionList) {
        this.actionList = actionList;
    }

    public Integer getLowerNode() {
        return lowerNode;
    }

    public void setLowerNode(Integer lowerNode) {
        this.lowerNode = lowerNode;
    }

    public String getStatusString() {
        return statusString;
    }

    public void setStatusString(String statusString) {
        this.statusString = statusString;
    }

    public String getParentName() {
        return parentName;
    }

    public void setParentName(String parentName) {
        this.parentName = parentName;
    }



    @Override
    public String getLogFormName() {
        if (StringUtils.isEmpty(super.logFormName)) {
            return "主题模块";
        } else {
            return super.logFormName;
        }
    }

    @Override
    public String getLogTitle() {
        if (StringUtils.isEmpty(super.logTitle)) {
            return "主题";
        } else {
            return super.logTitle;
        }
    }

    @Override
    public PlatformConstant.LogType getLogType() {
        if (super.logType == null) {
            return PlatformConstant.LogType.module_operate;
        } else {
            return super.logType;
        }
    }

    public Integer getStoreStatus() {
        return storeStatus;
    }

    public void setStoreStatus(Integer storeStatus) {
        this.storeStatus = storeStatus;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        BdpDasCategoryDTO that = (BdpDasCategoryDTO) o;
        return id.equals(that.id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id);
    }
}
